<template>
  <div class="goodsLayer">
    <div class="goodsLayer-tit-box cenBet">
      <div class="goodsLayer-tit">
        共选购 {{ $store.state.buyTicket.carTicketSumList.length }} 张票
      </div>
      <div v-if="$store.state.buyTicket.carTicketList.length!=0" class="goodsLayer-btn" @click="clearGoods()">
        清空购物车
      </div>
    </div>
    <div class="goodsLayer-ticket-box">
      <!-- v-if="item.body_ticket&&item.body_ticket.length!=0" -->
      <div v-for="(item, index) in $store.state.buyTicket.carTicketList" :key="index" class="goodsLayer-ticket">
        <div class="ticket-tit cenLeft">
          {{ item.body_ticket[0].tname }}
        </div>
        <div class="ticket-price-box cenCen ">
          <div class="new-price cenCen">
            <div v-if="item.body_ticket[0].enote&&item.body_ticket[0].sprice!=item.body_ticket[0].eprice" :class="[{'earlyBirdPrice':item.body_ticket[0].enote=='早鸟价'},{'originalPriceenote':item.body_ticket[0].enote=='原价'}]" class="new-price-logo cenRig discountPrice">
              {{ item.body_ticket[0].enote }}
            </div>
            <div v-if="item.body_ticket[0].eprice!==null&&item.body_ticket[0].eprice!==''" class="new-price-num cenCen">
              ¥ {{ item.body_ticket[0].eprice }}
            </div>
          </div>
          <div v-if="item.body_ticket[0].sprice&&item.body_ticket[0].sprice!=item.body_ticket[0].eprice" class="new-price cenCen">
            <div class="new-price-logo  old-price-logo cenRig">
              {{item.body_ticket[0].snote||"原价"}}:
            </div>
            <div class="new-price-num cenCen">
              <a href="javascript:void(0);" class="originalPrice">
                ¥{{ item.body_ticket[0].sprice }}
              </a>
            </div>
          </div>
        </div>
        <div class="ticket-num-box cenCen">
          <div style="padding-bottom: 3px;" class="btn-reduce cenCen" @click="upDataCarTicket('reduceTicket',item.body_ticket[0])">
            -
          </div>
          <div style="border-left:0px;border-right:0px;" class="btn-num cenCen">
            {{ item.body_ticket.length }}
          </div>
          <div style="padding-bottom: 3px;" class="btn-add cenCen" @click="upDataCarTicket('addTicket',item.body_ticket[0])">
            +
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import buyTicket from "./../../js/buyTicket.js";
export default {
  methods: {
    // 清空购物车
    clearGoods() {
      buyTicket.clearGoods();
    },
    // 更新购物车信息(加减票)
    upDataCarTicket(operator, ticket) {
      buyTicket.upDataCarTicket(operator, ticket);
    }
  }
};
</script>

<style scoped>
.goodsLayer {
  width: 100%;
  height: auto;
  max-height: 86%;
  overflow-y: auto;
  min-height: 380px;
  background: #3b3d42;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  padding-bottom: 168px;
}
.goodsLayer-tit-box {
  width: 100%;
  height: auto;
  min-height: 76px;
  border-bottom: 1px solid #292b2d;
  padding: 16px 26px;
}
.goodsLayer-tit {
  width: auto;
  height: auto;
  /* font-family: PingFangSC-Regular; */
  font-size: 24px;
  color: #ffffff;
  letter-spacing: -0.58px;
  text-align: center;
}
.goodsLayer-btn {
  width: auto;
  height: auto;
  opacity: 0.6;
  /* font-family: PingFangSC-Regular; */
  font-size: 22px;
  color: #d7d8d9;
  letter-spacing: -0.53px;
  text-align: center;
}
.goodsLayer-ticket-box {
  width: 100%;
  height: auto;
  padding: 0px 26px;
}
.goodsLayer-ticket {
  width: 100%;
  height: auto;
  min-height: 86px;
  border-bottom: 1px solid #292b2d;
  position: relative;
  padding: 16px 430px 16px 0px;
}
/* 标题 */
.ticket-tit {
  width: 100%;
  height: auto;
  min-height: 86px;
  /* font-family: PingFangSC-Medium; */
  font-size: 28px;
  color: #ffffff;
  text-align: left;
}
/* 价格部分 */
.ticket-price-box {
  position: absolute;
  right: 166px;
  top: 0px;
  width: auto;
  max-width: 300px;
  height: 100%;
  flex-wrap: wrap;
  padding: 13px 0px;
}

.new-price {
  width: auto;
  min-width: 160px;
  height: auto;
}
.new-price-logo {
  width: auto;
  height: 34px;
  padding: 0px 4px;
  border-radius: 2px;
  /* font-family: PingFangSC-Regular; */
  font-size: 18px;
  color: #eeeeee;
  text-align: right;
  min-width: 66px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.old-price-logo {
  background: #3b3d42;
  opacity: 0.4;
  /* font-family: PingFangSC-Regular; */
  font-size: 18px;
  color: #eeeeee;
}
.new-price-num {
  width: auto;
  height: 34px;
  padding: 0px 10px;
  /* font-family: PingFangSC-Medium; */
  font-size: 18px;
  color: #ffffff;
  margin-left: 6px;
}
.new-price-num > a {
  opacity: 0.4;
  /* font-family: PingFangSC-Regular; */
  font-size: 18px;
  color: #eeeeee;
  text-decoration: line-through;
}
/* 按钮部分 */
.ticket-num-box {
  position: absolute;
  right: 0px;
  top: 0px;
  width: auto;
  height: 100%;
  /* border: 1px solid red; */
}

.btn-reduce {
  width: 48px;
  height: 48px;
  border: 1px solid #636566;
  opacity: 0.6;
  background: rgba(33, 35, 37, 0.3);
  /* font-family: PingFangSC-Thin; */
  font-size: 34px;
  color: #eeeeee;
  border-right: none;
  border-top-left-radius: 2px;
  border-bottom-left-radius: 2px;
  cursor: pointer;
}
.btn-num {
  width: 59px;
  height: 48px;
  background: rgba(45, 47, 50, 0.7);
  border: 1px solid #545658;
  /* font-family: PingFangSC-Regular; */
  font-size: 30px;
  color: #eeeeee;
}
.btn-add {
  width: 48px;
  height: 48px;
  border: 1px solid #636566;
  opacity: 0.6;
  background: rgba(33, 35, 37, 0.3);
  /* font-family: PingFangSC-Thin; */
  font-size: 34px;
  color: #eeeeee;
  border-left: none;
  border-top-right-radius: 2px;
  border-bottom-right-radius: 2px;
  cursor: pointer;
  padding-bottom: 3px;
}
.btn-reduce:active,
.btn-add:active {
  background: rgba(255, 255, 255, 0.3);
}

/* 折扣价 */
.discountPrice {
  background-image: linear-gradient(-116deg, #3cb9ff 0%, #6044d4 100%);
}
/* 早鸟价 */
.earlyBirdPrice {
  background-image: linear-gradient(-116deg, #3cb9ff 0%, #6044d4 100%);
}
/* 原价 */
.originalPriceenote {
  background-image: linear-gradient(-116deg, #3cb9ff 0%, #6044d4 100%);
}
</style>
